package io.cici.samples.processors.test;

import com.alibaba.fastjson.JSONObject;

import io.cici.common.utils.CommonUtils;
import io.cici.worker.core.processor.ProcessResult;
import io.cici.worker.core.processor.TaskContext;
import io.cici.worker.core.processor.sdk.BasicProcessor;
import org.springframework.stereotype.Component;

import java.util.Optional;

/**
 * LogTestProcessor
 *
 * @author tjq
 * @since 2022/9/18
 */
@Component
public class LogTestProcessor implements BasicProcessor {

    @Override
    public ProcessResult process(TaskContext context) throws Exception {


        final String parseParams = null;
        final JSONObject config = Optional.ofNullable(JSONObject.parseObject(parseParams)).orElse(new JSONObject());

        final long loopTimes = Optional.ofNullable(config.getLong("loopTimes")).orElse(1000L);

        for (int i = 0; i < loopTimes; i++) {

        }

        return new ProcessResult(true);
    }
}
